<%@page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>

<%@page import="java.sql.Connection,
java.sql.PreparedStatement,
java.sql.ResultSet,
java.sql.SQLException,
java.sql.Statement,
java.util.ArrayList,
java.util.Date,
java.util.List"
%>
<%@page import= "edu.gdut.imis.goods.common.*"%>
<%@page import= "edu.gdut.imis.goods.entity.*"%>
<%@page import= "edu.gdut.imis.goods.dao.*"%>
<%@page import= "edu.gdut.imis.goods.business.*"%>
<%@page import= "edu.gdut.imis.goods.business.factory.EBOFactory"%>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>购物车</title>
    <link rel="shortcut icon" href="favicon1.ico" />
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/index.css">
    <style>
        table{
            border: 1px solid black;
            margin: 200px auto;
        }
        td{
            border: 1px solid black;
            height: 68px;
            width: 130px;
            text-align: center;
            font-size: 20px;
        }
    </style>
</head>
<body>
	
	<table>
        <tr>
            
            <td>编号</td>
			<td>类别</td>
			<td></td>
            <td><a href="addCategory.html" style="color: cornflowerblue;">增加</a></td>
            <td></td>
        </tr>
  
     


	<%
	response.setContentType("text/html;charset=utf-8");
	request.setCharacterEncoding("utf-8");
	
	String cid= null;
	
	String cname = null;
	

		Connection conn = null;
		Statement stmt = null;
	
		
		try {
		
			conn = DBConnector.getConn();
	
	
			String sql = "SELECT* FROM category_info";
	
			stmt = conn.createStatement();
			ResultSet rs = stmt.executeQuery(sql);

				while(rs.next()){
				cid = rs.getString(1);		
				
				cname = rs.getString(2);
			
				
    				%>
    				<tr>
                        <td><%=cid%></td>
                        <td><%=cname%></td>       
                        <td><a href="/Goods/showCategoryServlet?category=<%=cid%>" style="color: cornflowerblue;">查询</a></td>
                        <td><a href="/Goods/updateCategory.jsp?cid=<%=cid%>&update=1" style="color: cornflowerblue;">修改</a></td>
                        <td><a href="/Goods/showCategoryServlet?category=<%=cid%>&delete=1" style="color: cornflowerblue;">删除</a></td>
                    </tr>
    				<%
				}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		try {
			conn.close();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	
	
	
     
	
    
    
	
    
	%>
	</table>
</body>
</html>